package com.neusoft.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {
    private Integer code;
    private String msg;
    private T data;

    public static <T> Result<T> success(T data){
    	return new Result<T>(200,"success",data);
    }
    public static <T> Result<T> success(){
        return new Result<T>(200,"success",null);
    }
    public static <T> Result<T> fail(String msg){
    	return new Result<T>(400,msg,null);
    }
    public static <T> Result<T> fail(Integer code,String msg){
    	return new Result<T>(code,msg,null);
    }
    public static <T> Result<T> fail(Integer code,String msg,T data){
    	return new Result<T>(code,msg,data);
    }

}
